import service from '@/utils/request'
import qs from 'qs'
// eslint-disable-next-line no-unused-vars
const { httpPostForm, httpPost, httpGet } = service

const request = {
    //==================================分包商变更查询======================================
    //分包商变更查询基本信息
    findByIdBasic (billId) {
        return httpGet({
            url: `/outer/subcontractor/change/findById/${billId}`,
        })
    },
    //分包商变更查询资质信息
    findByIdqualification (id) {
        return httpGet({
            url: `/outer/subcontractor/change/qualification/index/${id}`,
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            }
        })
    },
    //新增分包商变更基础信息
    subcontractorChangeAdd (params) {
        return httpPost({
            url: '/outer/subcontractor/change/add',
            params
        })
    },
    //分包商变更查询企业主要管理人
    findByIdstaff (id) {
        return httpPostForm({
            url: `/outer/subcontractor/change/staff/index/${id}`,
        })
    },
    //分包商变更查询附件信息
    findByIdAttach (id) {
        return httpPostForm({
            url: `/outer/subcontractor/change/attach/index/${id}`,
        })
    },
    //分包商变更查询审核历史
    findByIdAuditHistory (params) {
        return httpPost({
            url: '/outer/audit/getAuditHistory',
            params: params
        })
    },
    //分包商变更提交审核
    findcommit (params) {
        return httpPost({
            url: '/outer/audit/commit',
            params: params
        })
    },
    //分包商变更按鈕更新
    getCurrentUnitInfo (params) {
        return httpPost({
            url: '/outer/audit/getCurrentUnitInfo',
            params: params
        })
    },
    //分包商变更审核
    audit (params) {
        return httpPost({
            url: '/outer/audit/audit',
            params: params
        })
    },
    //分包商变更撤回
    undoAudit (params) {
        return httpPost({
            url: '/outer/audit/undoAudit',
            params: params
        })
    },
    //分包商变更附件信息新增
    changeEnclosureAdd (params) {
        return httpPost({
            url: '/outer/subcontractor/change/attach/create',
            params: params
        })
    },
    //分包商变更分页列表
    changeBaseList (params) {
        return httpPost({
            url: '/outer/subcontractor/change/create/index',
            params: params
        })
    },
    //分包商变更业绩新增
    changeAchievementAdd (params) {
        return httpPost({
            url: '/outer/subcontractor/change/performance/create',
            params: params
        })
    },
    //分包商变更业绩列表
    changeAchievementList (params) {
        return httpPost({
            url: '/outer/subcontractor/change/performance/index',
            params: params
        })
    },
    //分包商变更资质信息新增
    changeQualificationsAdd (params) {
        return httpPost({
            url: '/outer/subcontractor/change/qualification/create',
            params: params
        })
    },
    //分包商变更主要管理人员新增
    changeMainManagerAdd (params) {
        return httpPost({
            url: '/outer/subcontractor/change/staff/create',
            params: params
        })
    },
    //分包商变更主要管理人员列表
    changeMainManagerList (billId) {
        return httpPost({
            url: `/outer/subcontractor/change/staff/index/${billId}`,
        })
    },
    //更新分包商变更基础信息
    changeBaseUpdate (params) {
        return httpPost({
            url: '/outer/subcontractor/change/update',
            params: params
        })
    },
    //分包商变更查询资质信息
    findByIdChangehistorList (params) {
        return httpGet({
            url: '/outer/subcontractor/get/by/id/change/history',
            params,
        })
    },
    //分包商变更附件列表
    getEnclosureChangeList (id) {
        return httpPost({
            url: '/outer/attachment/chnage/list',
            // 将json格式转换为字符串形式。解决传参问题
            params: qs.stringify({
                id: id,
            }),
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            }
        })
    },
    //分包商变更附件新增
    addEnclosureChange (params) {
        return httpPost({
            url: '/outer/attachment/change/update',
            params,
        })
    },
}

export default request